package cn.ffcs.bpmpvc.assignhandler;

import java.util.List;

import org.echoice.spring.SpringContextUtil;

import cn.ffcs.bpm.model.TransactProcessStatus;
import cn.ffcs.bpmpvc.services.AppBusinessReqService;
import cn.ffcs.bpmpvc.svc.TaskAssignHandler;
import cn.ffcs.bpmpvc.web.FlowRequestAction;
import cn.ffcs.organ.model.Organization;
import cn.ffcs.organ.model.Person;

public class CheckTaskAssignHandler implements TaskAssignHandler {

	public List<Person> executeAssign(TransactProcessStatus processStatus,Object context) {
		// TODO Auto-generated method stub
		AppBusinessReqService appBusinessReqService=(AppBusinessReqService)SpringContextUtil.getBean("appBusinessReqService");
		List list=null;
		Organization organization=(Organization)context;
		if(organization!=null){
			int orgLevel=organization.getOrgLevel();
			String superior=organization.getSuperior();
			if(orgLevel>2){
				list=appBusinessReqService.getAppBusinessReqDao().findPersonByOrg(Integer.valueOf(organization.getSuperior()));
			}else if(FlowRequestAction.HAOBAI_ID.equalsIgnoreCase(superior)){
				//对于号百公司下的部门提的需求
				list=appBusinessReqService.getAppBusinessReqDao().findPersonByOrg(Integer.valueOf(FlowRequestAction.HAOBAI_LEADER_ID));
			}
		}
		return list;
	}
}
